﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="QQ.aspx.cs" Inherits="WAD.WEB.Client.Page.QQ" %>
<%=html.ToString().Replace("<section class=\"mod_box mod_album_info\"", "<div id='divPlayer'></div><section class=\"mod_box mod_album_info\"")%>
<script>
    var alertIndex = 0;
    var divPlayer = null;
    var vtimer = null;
    var arrList = new Array();
    function load() {
        var isWX = navigator.userAgent.match(/MicroMessenger/i);

        vtimer = setInterval(function () {
            if (alertIndex >= 2) {
                clearInterval(vtimer);
                return;
            }

            if($(".container"))$(".container").css("max-width", "640px");
            if (screen != null) {
                if ($(".container"))$(".container").css("width", screen.width + "px");

                //微信打开时，解决不能显示视频问题
                if (divPlayer == null && isWX != null) {
                    $("#player").html("");
                    $("#player").hide();
                    var vid = '<%= vid %>';
                    var maxwidth = screen.width;
                    var maxheight = parseInt(maxwidth / 1.777);
                    $("#divPlayer").html("<iframe src='https://v.qq.com/iframe/player.html?vid=" + vid + "&width=" + maxwidth + "&height=" + maxheight + "&auto=0' style='width:" + maxwidth + "px;height:" + maxheight + "px;'></iframe>");
                    divPlayer = 1;
                }
            }

            //设置标题、LOGO   
            if ($(".tvp_poster_img") != null) {
                if (arrList.length == 0 || arrList[0] == null) {
                    arrList[0] = $(".tvp_poster_img").attr("data-pic");
                    if (arrList[0]&&arrList[0].indexOf("//") == 0)
                        arrList[0] = "http:" + arrList[0];

                    alertIndex++;
                    Set(document.title, arrList);
                }
            }


        }, 500);
    }

    //设置title,logo
    
    var logoItemHtml = '' + '<div class="col-xs-3"><img class = "logoItem" src="{src}" /></div>';
    function Set(title, imgList) {
        if ($_p("#title") == null)
            return;

        $_p("#title").val(title);

        // 默认第一张图片为头图
        if (imgList.length > 0) {
            $_p(".logo").attr("src", imgList[0]);
        }
        $(imgList).each(function () {
            $_p("#imgList").append(logoItemHtml.replace(/{src}/, this));
        });

        // 候选图片点击事件
        $_p(".logoItem").off("click");
        $_p(".logoItem").on("click", function () {
            $_p(".logo").attr("src", $(this).attr("src"));
        });
    }

    function $_p(id) {
        return $(id, window.parent.document);
    }
    load();
</script>